Robots have now reached a stage of development where they can potentially perform a number of tasks such as mail delivery, security patrol, visitor guidance and looking for leaks. All these tasks require a basic method for directing a robot for specific distances along a hallway as well as ways of detecting junctions and turns. Heretofore, research has been directed to methods for finding a path to a given location in such manner as to avoid obstacles. Information for these purposes has been obtained by sonar sensors. Unfortunately, an obstacle avoidance system is very sensitive to irregularities in the hall such as open doors and fire extinguishers.